<?php
declare (strict_types=1);

namespace app\backend\validate;

use think\Validate;

class LoginValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'sex' => 'require',
        'nickname' => 'require',
        'account' => 'require|max:25|min:2',
        'password' => 'max:25|min:6',
        'backend_member_id' => 'require',
        'past_time' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'sex.require' => '请输入性别！',
        'nickname.require' => '请输入学生姓名!',
        'account.require' => '请输入账号！',
        'account.max' => '账号不能超过25位！',
        'account.min' => '账号最少2位！',
        'password.max' => '密码不能超过25位！',
        'password.min' => '密码最少6位！',
        'backend_member_id.require' => '请输入老师名称！',
        'past_time.require' => '请输入期限时长！',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'login' => ['account', 'password'],
        'register' => ['account', 'password','sex','backend_member_id','past_time','nickname']
    ];
}
